local weapon = "none"

local OFF = 0
local R99 = 4
local R301 = 5

r99 = {
{X = 0,Y = 0,layer =  20},
{X = -4,Y = 12,layer = 50},
{X = 2,Y = 8,layer = 50},
{X = 3,Y = 10,layer = 50},
{X = -2,Y = 10,layer = 45},
{X = -5,Y = 16,layer = 45},
{X = -6,Y = 16,layer = 50},
{X = -8,Y = 10,layer = 45},
{X = -4,Y = 8,layer = 50},
{X = 2,Y = 15,layer = 45},
{X = 10,Y = 15,layer = 50},
{X = 5,Y = 8,layer = 45},
{X = 0,Y = 8,layer = 50},
{X = 3,Y = 10,layer = 50},
{X = 0,Y = 5,layer = 45},
{X = -5,Y = 5,layer = 50},
{X = -5,Y = 0,layer = 50},
{X = -3,Y = 5,layer = 45},
{X = 5,Y = 5,layer = 50},
{X = 6,Y = 4,layer = 50},
{X = 5,Y = -5,layer = 50},
{X = 5,Y = 0,layer = 45},
{X = 6,Y = 4,layer = 45},
{X = -2,Y = 2,layer = 45},
{X = -4,Y = 3,layer = 45},
{X = -8,Y = -2,layer = 50},	
{X = -4,Y = 3,layer = 45},
{X = -8,Y = -2,layer = 50},
{X = -4,Y = 3,layer = 45},
{X = -8,Y = -2,layer = 50},	
}

r301 = {
{X = 0,Y = 0,layer =  20},
{X = -5,Y = 15,layer =  70},
{X = -3,Y = 14,layer =  70},
{X = -5,Y = 13,layer =  70},
{X = -5,Y = 13,layer =  70},
{X = 0,Y = 10,layer =  70},
{X = 0,Y = 6,layer =  70},
{X = -3,Y = 6,layer =  70},
{X = -4,Y = 0,layer =  60},
{X = -3,Y = 5,layer =  70},
{X = -8,Y = -2,layer =  70},
{X = -3,Y = 5,layer =  70},
{X = 6,Y = 8,layer =  60},
{X = 6,Y = 8,layer =  70},
{X = 8,Y = 4,layer =  70},
{X = 11,Y = 1,layer =  70},
{X = 10,Y = 2,layer =  70},
{X = 4,Y = 2,layer =  70},
{X = 6,Y = 3,layer =  70},
{X = -3,Y = 5,layer =  70},
{X = -10,Y = 4,layer =  70},
{X = -4,Y = 6,layer =  70},
{X = -10,Y = -3,layer =  70},
{X = 0,Y = -3,layer =  70},
{X = -10,Y = -2,layer =  70},
{X = 3,Y = 6,layer =  60},
{X = 0,Y = 8,layer =  40},
}

function OnEvent(event, arg)

if (event == "MOUSE_BUTTON_PRESSED" and arg == OFF) then
    weapon = "none"
    OutputLogMessage("weapon = none\n")
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == R99) then
    weapon = "R99"
    OutputLogMessage("weapon = R99\n")
elseif (event == "MOUSE_BUTTON_PRESSED" and arg == R301) then
    weapon = "R301"
    OutputLogMessage("weapon = R301\n")
end

if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and weapon == "R99") then
	if arg == 1 then
        if IsMouseButtonPressed(3)then
            bEnabled = true
		    Sleep(15)
            for i = 1, #r99 do
                if IsMouseButtonPressed(1) then
                    MoveMouseRelative(r99[i].X, r99[i].Y)
                    Sleep(r99[i].layer);
			    end
            end
            bEnabled = false
        end
    end
end

if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and weapon == "R301") then
	if arg == 1 then
        if IsMouseButtonPressed(3)then
            bEnabled = true
		    Sleep(15)
            for i = 1, #r301 do
                if IsMouseButtonPressed(1) then
                    MoveMouseRelative(r301[i].X, r301[i].Y)
                    Sleep(r301[i].layer);
			    end
            end
            bEnabled = false
        end
    end
end
end